-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor the templating engine and the command tool cache et al. #615
Conversation
Use an allocation-free implementation of the ParamKey type. Fix formatting in BuildCommand.fs and syntax highlighting in _template.html.
It uses spans. For the most of allocation savings, FSharp.Formatting.Common now targets .NET Standard 2.1 too but the package is not yet updated; only the command tool will take advantage of all improvements.
Remove an unused source file. And use LINQ-to-XML to generate version.props.
The cache is both more secure and more compact (the cache's size for this project was reduced by a third, after using binary XML). And use a more reliable way to install the command tools during documentation generation.
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0"> | |||
<PropertyGroup> | |||
<TargetFramework>netstandard2.0</TargetFramework> | |||
<TargetFrameworks>netstandard2.0; netstandard2.1</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why both?
/// An abbreviation for 'string' representing a strong name for a parameter key | ||
type ParamKey = string | ||
#endif | ||
with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "with" is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(And will not compile in release mode??)
Yes just multi-target them, or move them all to .NET Standard 2.1 (probably ok?) |
Thanks, this looks great. Just move everything to netstandard 2.1 I think? |
This PR:
DataContractSerializer
instead of the insecureBinaryFormatter
. The XML output of the serializer is encoded in binary to reduce its size.Templating.fs
to use a more efficientSpan
-based single-pass algorithm.Options.fs
, making them allocate less.AssemblyInfo.?s
andversion.props
, the latter of which being now generated with LINQ-to-XML.As a consequence of the templating engine rewrite, the
FSharp.Formatting.Common
package multi-targets to .NET Standard 2.1 in addition to 2.0, to take advantage of theStringBuilder.Append
overload that takes aReadOnlySpan
(in .NET Standard 2.0 the span's content will be first copied to a string). The command tool will automatically use the .NET Standard 2.1 version.However, the other public packages -namely
FSharp.Formatting
andFSharp.Formatting.Literate
- still target only .NET Standard 2.0 because of concerns about the packages' size being doubled. Should I multi-target them as well?